<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <base target="mainFrame">
    <meta charset="UTF-8">
    <title>网站首页</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <script th:src="@{/js/jquery-2.1.4.min.js}"></script>
    <style>
        body {
            width: 100%;
            height: 100%;
            margin: 0;
            overflow: hidden;
            background-color: #FFFFFF;
            font-family: "Microsoft YaHei", sans-serif;
        }
        .pageSidebar{
            width: 240px;
            height:100%;
            padding-bottom: 30px;
            overflow: auto;
            background-color: #e3e3e3;
        }
        .splitter {
            width: 5px;
            height: 100%;
            bottom: 0;
            left: 240px;
            position: absolute;
            overflow: hidden;
            background-color: #fff;
        }
        .pageContent{
            height: 100%;
            min-width: 768px;
            /*left: 246px;*/
            /*top: 0;*/
            /*right: 0;*/
            z-index: 3;
            padding-bottom: 30px;
            position: absolute;
        }
        .pageContainer{
            bottom: 0;
            left:0;
            right: 0;
            top: 53px;
            overflow: auto;
            position: absolute;
            width: 100%;
        }
        .footer {
            width: 100%;
            height: 30px;
            line-height: 30px;
            margin-top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            position: absolute;
            z-index: 10;
            background-color:#DFDFDF;
        }
    </style>
</head>
<body>
<h1>首页</h1>
<div class="container">
    <div class="row">
        <div class="span8">
            <ul class="nav nav-pills">
                <li class="active"><a href="#">Home</a></li>
                <li><a href="user/reg">注册</a></li>
                <li><a href="user/login">登录</a></li>
                <li><a href="product/list">商品</a></li>
                <li><a th:if="${session.loginUser!=null}" th:href="@{'cart/?userId='+${session.loginUser.id}}">购物车</a></li>
                <li><a href="seckill/seckillList">秒杀</a></li>
                <li><a href="javascript:;" id="seckill">秒杀(缓存页面)</a></li>
                <li><a href="order/orders">我的订单</a></li>
                <li><a href="user/logout">注销</a></li>
            </ul>
        </div>
    </div>
    <div id="seckill_page" class="panel"></div>
    <div class="pageContent">
        <iframe src="" id="mainFrame" name="mainFrame" frameborder="0" width="100%"  height="100%"></iframe>
    </div>
</div>

<script>
    $(function () {
        $("#seckill").click(function () {
            $.get('seckill/seckillListByCache',function (html) {
                $("#seckill_page").html(html);
                // var child = $("#mainFrame").contents();
                // child.append("<div>"+html+"</div>");
            })
        });
        login.initPage();
    })

    var login = {
        //初始化页面跳转，为了防止从iframe跳转到login页面直接在iframe中显示login页面
        initPage: function () {
            //alert(location.href);
            if (window.top != window.self) {
                top.location.href = location.href;
            }
        }
    }
</script>
</body>
</html>